/*
 * Copyright (C) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef IMAGE_KNIFE_C_KEKE_IMAGEKNIFE_WRAPPER_H
#define IMAGE_KNIFE_C_KEKE_IMAGEKNIFE_WRAPPER_H

#include <memory>
namespace ImageKnifePro {

/**
 * @brief ImageKnife包装对象，持有对象share_ptr
 * 纯C接口通过该对象的构造析构，维持原对象share_ptr的一个引用计数，来管理现有CPP对象生命周期
 */
template <typename T>
class ImageKnifeWrapper {
public:
    ImageKnifeWrapper(std::shared_ptr<T> ptr) : ptr_(ptr)
    {
    }

    std::shared_ptr<T> GetPtr() const
    {
        return ptr_;
    }
private:
    std::shared_ptr<T> ptr_;
};

}

#endif //IMAGE_KNIFE_C_KEKE_IMAGEKNIFE_WRAPPER_H
